package com.mybatisplus.mp.service;

import com.mybatisplus.mp.mapper.UserMapper;
import com.mybatisplus.mp.myanno.Retry;
import com.mybatisplus.mp.pojo.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

@Service
public class VersionLockService {
    @Autowired
    private UserMapper userMapper;

    @Transactional
    @Retry
    public void versionLock(User user) {
        userMapper.updateById(user);
    }

    @Retry
    public User around(User user) {
        System.out.println(user);
        return user;
    }
}
